package cn.tedu.spring6;

import org.springframework.beans.factory.FactoryBean;


import java.text.SimpleDateFormat;
import java.util.Date;


public class DateFactoryBean implements FactoryBean<Date> {

    public String strdate;

    public DateFactoryBean(String strdate) {
        this.strdate = strdate;
    }

    @Override
    public Date getObject() throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = sdf.parse(strdate);
        return date;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }
}
